(Al-Ahraf) 7 : 142
وَوَاعَدْنَا مُوسَىٰ ثَلَاثِينَ لَيْلَةً وَأَتْمَمْنَاهَا بِعَشْرٍ فَتَمَّ مِيقَاتُ رَبِّهِ أَرْبَعِينَ لَيْلَةً ۚ وَقَالَ مُوسَىٰ لِأَخِيهِ هَارُونَ اخْلُفْنِي فِي قَوْمِي وَأَصْلِحْ وَلَا تَتَّبِعْ سَبِيلَ الْمُفْسِدِينَ

And We promised thirty nights for Moses and We completed it with ten, thus he completed forty days the term of meeting his Lord; and Moses said to his brother Haroon: "You represent me in my people, and you reform, and you shouldn't follow the path of mischief-makers".

Before inviting Moses to Mount Sina for getting the Book of Guidance for the Children of Israel, he and Haroon had led their people according to the Inspiration received from the Lord.